package service.factory;

import service.CargoManager;
import service.UserManager;
import service.WarehouseManager;
import service.impl.CargoManagerImpl;
import service.impl.WarehouseManagerImpl;
import service.impl.UserManagerImpl;
import dao.factory.DaoFactory;

public class ManagerFactory {
	
	private static UserManager userManager;
	private static CargoManager cargoManager;
	private static WarehouseManager warehouseManager;
	
	public static UserManager getUserManagerInstance(){
		if (userManager==null) {
			synchronized (DaoFactory.class) {
				if (userManager==null) {
					userManager = new UserManagerImpl();
				}
			}
		}
		return userManager;
	}
	
	public static WarehouseManager getWarehouseManagerInstance(){
		if (warehouseManager==null) {
			synchronized (DaoFactory.class) {
				if (warehouseManager==null) {
					warehouseManager = new WarehouseManagerImpl();
				}
			}
		}
		return warehouseManager;
	}
	
	public static CargoManager getCargoManagerInstance(){
		if (cargoManager==null) {
			synchronized (DaoFactory.class) {
				if (cargoManager==null) {
					cargoManager = new CargoManagerImpl();
				}
			}
		}
		return cargoManager;
	}

	

}
